<template>
	<view class="sp-section sp-field">
		<!-- 栏位照片 -->
		<view class="sp-field__image">
			<image :src="info.image + '?x-oss-process=image/resize,m_fixed,w_430'" mode="widthFix"></image>
			<sp-tag :text="info.ai_has_feed" />
		</view>
		
		<!-- 栏位详情 -->
		<view class="sp-field__info">
			<view class="sp-field__info-name">{{ build[info.building_id] }} - {{ info.column_name }}</view>
			<view class="sp-field__info-desc">刷新时间: {{ info.operation_time }}</view>
			<view class="sp-field__info-person">料槽形状: {{ info.shape }}</view>
			<view class="sp-field__info-tags">
				<!-- <u-tag :text="info.ai_has_feed" :bgColor="colorMap[info.ai_has_feed]" size="mini" /> -->
				<!-- <u-tag v-if="info.material_status == '适量'" text="适量" type="primary" size="mini" />
				<u-tag v-else :text="info.material_status" :type="info.material_status == '过满' ? 'warning' : 'error'" size="mini" />
				<u-tag v-if="info.occlusion_level" :text="info.occlusion_level" :type="info.occlusion_level === '50%以下' ? 'primary' : 'error'" size="mini" style="margin-left: 10px;" />
				<u-tag v-if="info.operation_executed == '调整下料器'" :text="info.operation_executed" type="success" size="mini" style="margin-left: 10px;" /> -->
			</view>
		</view>
	</view>
</template>

<script>
	import { file } from '@/api/task.js'
	import spTag from '@/components/sp-ui/sp-tag.vue'
	
	export default {
		name: 'spIndex',
		components: {
			spTag
		},
		data () {
			return {
				file,
				info: {},
				colorMap: {
				  '适量': '#79E984',
				  '偏多': '#FF9F58',
				  '偏少': '#91C1FF',
				  '过满': '#F86060',
				  '空槽': '#59D3D3',
				  '未知': '#C3C3C3',
				  'AI其他': '#fbd950'
				},
				build: {}
			}
		},
		onLoad (option) {
			this.info = JSON.parse(option.info)
			const build = uni.getStorageSync('build')
			build.forEach(item => {
				this.build[item.id] = item.farm_name
			})
		},
		onShow () {},
		created () {},
		mounted () {},
		methods: {},
		onPullDownRefresh () {},
		onShareAppMessage () {}
	}
</script>

<style lang="less" scoped>
	.sp-field__image {
		width: 100%;
		margin: 0 auto;
	}
</style>
